﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EnvironmentManagerSystem.MODE;
using EnvironmentManagerSystem.BLL;

namespace EnvironmentManagerSystem
{
    public partial class ChangeMainBasicData : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (StfInfo.ReSession()) return; if (!IsPostBack)
            {
                BindingBigKindList();
            }
        }

        private void BindingBigKindList()
        {
            this.ddlMainKindName.Items.Clear();
            BasicDataMainDataCollection lst = BasicData.GetBigList();
            if (lst != null)
            {
                for (int i = 0; i < lst.Count; i++)
                {
                    ddlMainKindName.Items.Add(lst[i].DataKindName);
                }
            }
        }

        protected void btnOk_Click(object sender, EventArgs e)
        {
            if (this.txtMainKindName.Text == string.Empty)
            {
                Jscript.Alert("请输入要修改的类别名称", this);
                return;
            }
            if (BasicData.UpDataMainKindNameByName(this.ddlMainKindName.SelectedItem.Text.Trim(), this.txtMainKindName.Text.Trim()) > 0)
            {
                Response.Write("<script>alert('修改成功');window.parent.art.dialog.list['修改大类'].close();</script>");
            }
            else
            {
                Jscript.Alert("修改失败", this);
            }
        }

        #region 按钮(取消)(x)
        protected void btnNo_Click(object sender, EventArgs e)
        {
            Response.Write("<script>window.parent.art.dialog.list['修改大类'].close();</script>");
        }
        #endregion
    }
}
